#include<stdio.h>
#include<stdlib.h>
typedef struct node *stack;
struct node{
    int data;
    struct node *next;
};
typedef struct Node{
    stack top;
    int count;   //size of stack
}*Linkstack;

Linkstack s;
void Pop(Linkstack s){
    stack p=s->top;
    s->top=p->next;
    free(p);
    s->count--;
}


void Push(Linkstack s,int dat){ 
    stack p=(stack)malloc(sizeof(struct node));
    p->data=dat;
    p->next=s->top;
    s->top=p;
    s->count++;
    free(p);
   

}

Linkstack GetBinary(Linkstack s,int dat){
    int cnt;
    while(dat){
        cnt=dat%2;
        Push(s,cnt);
        dat/=2;
    }
     
    return s;

}
int main(){
    FILE *fp,*fo;
    fp = fopen("in.txt", "r");
    fo = fopen("out.txt", "w");
    int cnt=0;
    fscanf(fp,"%d",&cnt);

    while(cnt!=-1){
        //结构体指针一定需要malloc
        s=(Linkstack)malloc(sizeof(struct Node));
        s->top==NULL;
        s->count=0;
        printf("%d\n",cnt);

        s=GetBinary(s,cnt);
        fprintf(fo,"%d-->",cnt);  
        while(s->count){
            stack r=s->top;
            fprintf(fo,"%d",r->data);
            Pop(s);
            
        }
       
        fprintf(fo,"%\n"); 
         
        fscanf(fp,"%d",&cnt);

    }
    fclose(fp);
    fclose(fo);
    


}